var __errMsgIdPrefix="validate.msg.";
var __isSubmiting=false;
function processResultMsg(testResult,field,msg)
{
	if(testResult)
	{
		var spanObj=document.getElementById(__errMsgIdPrefix+field.name);
		setAlertText(field,msg,spanObj);
		return 1;
	}
	return 0;
}
String.prototype.lengthB=function ()
{
	var j=0;
	for(var i=0;i<this.length;i++)
	{
		if(this.charCodeAt(i)>255)
		{
			j=j+2;
		}
		else
		{
			j++;
		}
	}
	return j;
}
function getVarValue(v)
{
	var retu=v;
	if(v&&v.length>0&&v.substring(0,1)=="$")
	{
		retu=document.all[v.substring(1)].value;
	}
	return retu;
}

/**
* \u6e05\u9664\u6240\u6709\u9a8c\u8bc1\u8868\u5355\u7684\u63d0\u793a\u4fe1\u606f
*/
function clearAllErrorMsg()
{
	var spanErrID=document.getElementsByTagName("span");
	if(spanErrID.length>0)
	{
		for(var k=0;k<spanErrID.length;k++)
		{
			if(spanErrID[k].id&&spanErrID[k].id.substring(0,__errMsgIdPrefix.length)==__errMsgIdPrefix)
			{
				spanErrID[k].innerText="";
			}
		}
	}
}
window.attachEvent("onresize",showPaddingDiv);
var __div1;
function showPaddingDiv(){
	if(!__isSubmiting)
	{
		return;
	}
	if(typeof(__div1)=="undefined")
	{
	    __div1 = document.createElement("DIV");
    }
    __div1.style.position = "absolute";
    __div1.style.left = 0;
    __div1.style.top = 0;
    __div1.style.width=document.body.clientWidth;
    __div1.style.height =document.body.clientHeight;
    __div1.style.zIndex = "999";
    __div1.style.filter = "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
    __div1.style.backgroundColor="#2A4A6B";
    __div1.align = "center"
    getPaddingContent();
    document.body.appendChild(__div1);
//	hideSelectForm(__div1);
	hideSelectForm1();
}

var __div2;
function getPaddingContent(){
	if(typeof(__div2)=="undefined")
	{
	    __div2 = document.createElement("DIV");
    }
    __div2.style.position = "absolute";
    __div2.style.zIndex="1000";
    __div2.style.width = "180";
    __div2.style.height="40";
    __div2.align = "center"
    __div2.style.backgroundColor="aqua";
    __div2.innerHTML = "<br>\u6b63\u5728\u5904\u7406\u4e2d\u8bf7\u7a0d\u5019... <br><br>";
    __div2.style.left =(document.body.clientWidth+document.body.scrollLeft-180)/2+2;
    __div2.style.top = (document.body.clientHeight+document.body.scrollTop-40)/2+2;
    __div2.style.filter="progid:DXImageTransform.Microsoft.Shadow(color=#003399,direction=135,strength=5);"
    document.body.appendChild(__div2);
}
function hideSelectForm1()
{
    var opts = document.getElementsByTagName("SELECT");
    if (opts == null || typeof(opts) == "undefined")
        return ;
    for (var i=0; i<opts.length; i++){
        opts[i].style.visibility = "hidden";
    }
}

function hideSelectForm(layerObj)
{
	var s=document.getElementsByTagName("select");
	if(!s)
	{
		return;
	}
	for(var i=0;i<s.length;i++)
	{
		var a1=false;
		var a2=false;
		var select1Left=getAbsoluteLeft(s[i]);
		var select1Top=getAbsoluteTop(s[i]);
		var select1Height=select1.offsetHeight;
		var select1Width=select1.offsetWidth ;
		
		var layerObjLeft=getAbsoluteLeft(layerObj);
		var layerObjTop=getAbsoluteTop(layerObj);
		var layerObjHeight=layerObj.offsetHeight;
		var layerObjWidth=layerObj.offsetWidth ;	
		
		var x1EndPoint=select1Width+select1Left;//a????
		var x2EndPoint=layerObjWidth+layerObjLeft;//b????
		if(layerObjLeft<x1EndPoint&&select1Left<x2EndPoint)//
		{
			a1=true
		}
		x1EndPoint=select1Height+select1Top;//a????
		x2EndPoint=layerObjHeight+layerObjTop;//b????
		if(layerObjTop<x1EndPoint&&select1Top<x2EndPoint)//
		{
			a2=true
		}
		if(a1&&a2)
		{
			s[i].style.display="none";
		}		
	}	
}

function getAbsoluteTop(obj)
{
	var pObj=obj;
	var top=0;
	while(true)
	{
		top+=pObj.offsetTop;
		if(pObj.offsetParent.tagName=="BODY")
		{
			return top;
		}
		pObj=pObj.offsetParent;
	}
}
function getAbsoluteLeft(obj)
{
	var pObj=obj;
	var left=0;
	while(true)
	{
		left+=pObj.offsetLeft;
		if(pObj.offsetParent.tagName=="BODY")
		{
			return left;
		}
		pObj=pObj.offsetParent;
	}
}


function setAlertText(textObj,errorMsg,spanObj)
{
	if(textObj)
	{
		var id=__errMsgIdPrefix+textObj.name;
		if(spanObj)
		{
			if(spanObj.innerText.length>0)
			{
				spanObj.innerText+=errorMsg;
			}
			else
			{
				spanObj.innerText=errorMsg;
			}
		}
		else
		{
			var txt="<span id=\""+id+"\" style=\"color:red\">"+errorMsg+"</span>";
			textObj.insertAdjacentHTML("afterEnd",txt);
		}
	}
}